# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python-yara-python-dex
_pkgname=${pkgname#python-}
pkgver=1.0.9.r0.g84ad7d2
pkgrel=1
pkgdesc='The Python interface for YARA.'
arch=('x86_64' 'aarch64')
url='https://github.com/MobSF/yara-python-dex'
license=('Apache-2.0')
depends=('python')
makedepends=('git' 'python-setuptools' 'glibc' 'yara')
provides=('python-yara')
conflicts=('python-yara' 'python-yara-rednaga')
replaces=('python-yara-rednaga')
options=(!emptydirs)
source=("git+https://github.com/MobSF/${_pkgname}.git")
sha512sums=('SKIP')

pkgver() {
  cd $_pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

prepare() {
 cd $_pkgname

 git submodule update --init --recursive
}

build() {
  cd $_pkgname

  python setup.py build
}

package() {
  cd $_pkgname

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

